package flex.persistence {

	public class GenerationType extends AbstractType {
		protected static var localInstantiation:Boolean = false;
		
		private static var _AUTO:GenerationType; 
		public static function get AUTO():GenerationType {
			if(!_AUTO) { 
				localInstantiation = true; 
				_AUTO = new GenerationType("AUTO");
				localInstantiation = false;
			}
			return _AUTO;
		} 
		private static var _MANUAL:GenerationType; 
		public static function get MANUAL():GenerationType {
			if(!_MANUAL) { 
				localInstantiation = true; 
				_MANUAL = new GenerationType("MANUAL");
				localInstantiation = false;
			}
			return _MANUAL;
		} 
		
		public static function valueOf(name:String):GenerationType {
			for each(var val:GenerationType in values()) {
				if(val.name.toUpperCase() == name.toUpperCase()) return val;
			}
			return null;
		}
		
		public static function values():Array {
			return [AUTO, MANUAL];
		}
		
		public function GenerationType(name:String) {
			if(!localInstantiation) throw Error("Private constructor");
			this.name = name;
		}
		
	}
}